package com.zx.common.tools.id.impl;

import com.zx.common.tools.id.IdGenerator;
import com.zx.core.utils.SnowflakeIdUtils;

/**
 * 雪花算法ID生成器实现
 */
public class SnowflakeIdGenerator implements IdGenerator {

    private final SnowflakeIdUtils snowflakeIdUtils;

    public SnowflakeIdGenerator(long datacenterId, long workerId) {
        this.snowflakeIdUtils = new SnowflakeIdUtils(datacenterId, workerId);
    }

    @Override
    public String generateId() {
        return String.valueOf(snowflakeIdUtils.nextId());
    }
}